The present disclosure relates generally to computer systems and software, and more particularly to techniques for reducing contention windows in computing environments.
In the database world, there are two common types of locking that are performed on database records that can be accessed and updated by more than one user: optimistic locking and pessimistic locking. These locking techniques are used to avoid data that has been updated by multiple users from going into an inconsistent state. In pessimistic locking, when a first user accesses a record, the record goes into a lock state. Any other user who attempts to access the record will be prevented from accessing it until the first user's action completes. For optimistic locking, the system lets multiple users access the record. If only one user updates the record, then there is no conflict and no delay was incurred by either user. In situations where both users attempt to update the record, the system can commit the first update it receives, mark the database record as updated, and reject any subsequent updates that are received to an out of date record.
Both locking schemes present problems that lead to a poor user experience. In pessimistic locking, users are delayed in performing actions. These delays may not be acceptable in time sensitive applications. Optimistic locking can reduce delays, but when a conflict is detected, the user may be forced to start over and make all of their changes again to the updated object. Embodiments of the invention address these and other problems.